﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Betop.Lib.Core.Base;
using Betop.Lib.Common;
namespace Betop.Lib.Core.Log.Operate
{
    public class LogOperateBO : CommonOperate<LogOperateInfo>
    {
        private LogOperateDAL _logOperate;

        protected override BaseDAL DAL
        {
            get
            {
                return _logOperate;
            }
        }
        public LogOperateBO()
        {
            _logOperate = new LogOperateDAL();
        }

        public void Write(OperateType operateType, string tableName, string detail)
        {
            LogOperateInfo info = new LogOperateInfo();
            info.InputTime = DateTime.Now;
            if (AppSession.LoginName == null)
            {
                info.LoginName = "";
                info.UserName = "";
            }
            else
            {
                info.LoginName = AppSession.LoginName;
                info.UserID = AppSession.UserID;
                info.UserName = AppSession.UserName;
            }

            info.OperateType = (int)operateType;
            info.TableName = tableName;
            info.Remark = detail;

           
            this.Save(info);
           
        }

        public void Delete()
        {
            _logOperate.Delete();
        }

        public void Delete(string startTime, string endTime)
        {
            _logOperate.Delete(startTime, endTime);
        }
    }

}
